package com.example.usagelock;

import java.util.*;

import com.example.surfaceball.*;

import android.content.*;
import android.graphics.*;

public class Label {
	
	ArrayList<Bitmap> b;
	Rect r;
	int centerX, centerY;
	Context context;
	
	Paint paint;
	
	boolean draw;
	
	int imageType;
	
	public Label(Context context, int left, int top, int right, int bottom) {
		super();
		
		r = new Rect(left, top, right, bottom);
		
		centerX = (left + right) / 2;
		centerY = (top + bottom) / 2;
		
		b = new ArrayList<Bitmap>();
		
		this.context = context;
		
		draw = true;
		
		paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		
		// TODO Auto-generated constructor stub
	}
	
	void setImage(int resourceOfImage){
		b.add(BitmapFactory.decodeResource(context.getResources(), resourceOfImage));
	}
	
	void setImage(Bitmap[] images){
		if(images.length > 3)
			return;
		
		b.clear();
		for(int i = 0; i < ImageManager.NumberOfImageStyle; i++){
			b.add(images[i]);
		}
	}
	
	int getImageType(){
		return imageType;
	}
	
	void setImageType(int imageType){
		this.imageType = imageType;
	}
	
	void drawBitmap(Canvas canvas, int index){
		canvas.drawBitmap(b.get(index), null, r, paint);
	}

	int draw(Canvas canvas, PointF point, int count){
		
		if(count==0){
			canvas.drawBitmap(b.get(0), null, r, paint);
		}
		
		if(point!=null){
			if(draw==true && count>=1){				
				canvas.drawBitmap(b.get(1), null, r, paint);
			}
		}
		
		return count;
	}
}
